﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TA.Turbo.Controls
{
	/// <summary>
	/// Definition of the CSS style property.
	/// </summary>
	public class StylePropertyDefinition : PropertyDefinition<string>
	{
		/// <summary>
		/// Ctor.
		/// </summary>
		public StylePropertyDefinition()
			: base("Style", "S", "")
		{
			this.IsHTML = true;
		}
		/// <summary>
		/// Gets the value of this property for the specified control.
		/// </summary>
		/// <param name="control"></param>
		/// <returns></returns>
		protected internal override string GetValue(TControl control)
		{
			if (string.IsNullOrEmpty(control.Style.Value))
				return this.DefaultValue;
			return control.Style.Value;
		}
		/// <summary>
		/// Sets the value of this property for the specified control.
		/// </summary>
		/// <param name="control"></param>
		/// <param name="value"></param>
		protected override void SetValue(TControl control, string value)
		{
			control.Style.Value = value;
		}
	}
}
